import pyrcswitch

class Switch:
	def __init__(self, homeswitch, room, label, system_code, unit_code):
		self.homeswitch = homeswitch
		self.room = room
		self.label = label
		self.active = False
		self.system_code = system_code
		self.unit_code = unit_code
	
	def switch_on(self):
		pyrcswitch.switchOn(self.system_code, self.unit_code)
		self.active = True
		self.homeswitch.on_change(self)
	
	def switch_off(self):
		pyrcswitch.switchOff(self.system_code, self.unit_code)
		self.active = False
		self.homeswitch.on_change(self)
	

